﻿using AutoMapper;
using wwl.Contract.Dtos.Responses.Rbac;
using wwl.Domain.Entities.Rbac;

namespace wwl.Application.Mappings.Rbac
{
  /// <summary>
  /// 用户实体与DTO的映射配置类
  /// </summary>
  public class UserProfile : Profile
  {
    /// <summary>
    /// 构造函数，配置用户实体与DTO的映射关系
    /// </summary>
    public UserProfile()
    {
      // 创建从User实体到UserResponse的映射
      CreateMap<User, UserResponse>()
          // 自定义映射：将实体的Status属性（枚举类型）转换为字符串类型后映射到DTO的Status属性
          .ForMember(dest => dest.Status, opt => opt.MapFrom(src => src.Status.ToString()));
    }
  }
}